package demo13;

import java.io.File;
import java.io.FileFilter;

/**
 * @author Huangjin
 * @version 1.0
 * describe:
 * @date 2023/3/6 20:21
 */
public class Test06 {
    public static void main(String[] args) {
        File dir = new File(".");
//        if (dir.isDirectory()){
//            File[] subs = dir.listFiles( file->file.getName().contains("s"));
//            for (File sub : subs){
//                System.out.println(sub.getName());
//            }
//        }
        if (dir.isDirectory()){
            File[] subs = dir.listFiles(new FileFilter() {
                @Override
                public boolean accept(File file) {
                    return file.getName().contains("s");
                }
            });
            for (File sub : subs){
                System.out.println(sub.getName());
            }
        }
    }
}
